//
//  MLRNController.m
//  iOSReactNative
//
//  Created by 洛耳 on 2016/11/24.
//  Copyright © 2016年 ml. All rights reserved.
//

#import "MLRNController.h"
#import "RCTRootView.h"
#import "RCTBundleURLProvider.h"
#import "UINavigationController+FDFullscreenPopGesture.h"

@interface MLRNController ()

@end

@implementation MLRNController
#pragma mark - vc即将显示
-(void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    self.navigationController.fd_fullscreenPopGestureRecognizer.enabled = NO;
    [self.navigationController setNavigationBarHidden:YES animated:YES];
}
#pragma mark - VC已经完全退出后
-(void)viewDidDisappear:(BOOL)animated{
    [super viewDidDisappear:animated];
    self.navigationController.fd_fullscreenPopGestureRecognizer.enabled = YES;
    [self.navigationController setNavigationBarHidden:NO animated:YES];
}
#pragma mark - 入口
- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.title = @"rn";
    self.view.backgroundColor = [UIColor orangeColor];
    NSString *urlStr = @"http://127.0.0.1:8081/index.ios.bundle?platform=ios&dev=true";
    NSURL *jsCodeLocation = [NSURL URLWithString:urlStr];
    
    RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation moduleName:@"iOSReactNative" initialProperties:nil launchOptions:nil];
    
    rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1.0f];
    
    rootView.frame = [[UIScreen mainScreen] bounds];
    
    [self.view addSubview:rootView];
    
}

@end
